package com.java.distributed.beans;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;


public class MySession implements HttpSession {

    private String sessionId;

    private Map<String, Object> map = new HashMap<>();

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    @Override
    public void setAttribute(String key, Object value){
        map.put(key,value);
    }

    @Override
    public Object getAttribute(String key) {
        return map.get(key);
    }

    @Override
    public void putValue(String s, Object o) {

    }

    @Override
    public void removeAttribute(String s) {
        map.remove(s);
    }

    @Override
    public void removeValue(String s) {

    }

    @Override
    public void invalidate() {

    }

    @Override
    @JsonIgnore
    public boolean isNew() {
        return false;
    }

    @Override
    @JsonIgnore
    public long getCreationTime() {
        return 0;
    }

    @Override
    @JsonIgnore
    public String getId() {
        return null;
    }

    @Override
    @JsonIgnore
    public long getLastAccessedTime() {
        return 0;
    }

    @Override
    @JsonIgnore
    public ServletContext getServletContext() {
        return null;
    }

    @Override
    public void setMaxInactiveInterval(int i) {

    }

    @Override
    @JsonIgnore
    public int getMaxInactiveInterval() {
        return 0;
    }

    @Override
    @JsonIgnore
    public HttpSessionContext getSessionContext() {
        return null;
    }



    @Override
    @JsonIgnore
    public Object getValue(String s) {
        return null;
    }

    @Override
    @JsonIgnore
    public Enumeration<String> getAttributeNames() {
        return null;
    }

    @Override
    @JsonIgnore
    public String[] getValueNames() {
        return new String[0];
    }

}
